package cn.jserv.ddns.util;

import okhttp3.*;

import java.io.IOException;

/**
 * @author 蒋登伟
 * @create 2022-03-21 16:24
 */
public class HttpUtils {

    public static Response post(String url, String jsonBody) throws IOException {
        OkHttpClient client = new OkHttpClient();
        MediaType jsonType = MediaType.parse("application/json; charset=utf-8");
        RequestBody body = RequestBody.Companion.create(jsonBody, jsonType);
        Request request = new Request.Builder()
                .url(url).post(body).build();
        Call call = client.newCall(request);
        return call.execute();
    }

}
